//
//  NewsCenterHeadView.m
//  Aierle
//
//  Created by jiayibai-02por on 2017/5/25.
//  Copyright © 2017年 WillyZhao. All rights reserved.
//

#import "NewsCenterHeadView.h"

@interface NewsCenterHeadView()

@property (nonatomic, strong) UIImageView *advertiseImageView;
@property (nonatomic, strong) UILabel *topLabel;
//账号:502897973@qq.com 密码:19930815Lzs..02YM16

@end

@implementation NewsCenterHeadView

- (instancetype)initWithFrame:(CGRect)frame {

    if (self = [super initWithFrame:frame]) {
        
        [self initializeView];
    }
    return self;
}

- (void)setImageUrl:(NSString *)imageUrl {
    
    _imageUrl = imageUrl;
    NSURL *url = [NSURL URLWithString:imageUrl];
    [self.advertiseImageView sd_setImageWithURL:url];
//    [self.advertiseImageView sd_setImageWithURL:url placeholderImage:nil];
}

- (void)setTopLabelName:(NSString *)topLabelName {

    _topLabelName = topLabelName;
    if (topLabelName.length != 0) {
        
        self.topLabel.text = topLabelName;
    }
}

- (void)initializeView {
    
    self.advertiseImageView = [[UIImageView alloc] init];
    self.advertiseImageView.frame = self.bounds;
    self.advertiseImageView.backgroundColor = YBKRGBCOLOR(241, 241, 241, 1);
    [self addSubview:self.advertiseImageView];
    
    UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, YBKAdaptiveH(200)-20, Screen_width, 20)];
    backView.backgroundColor = YBKRGBCOLOR(0, 0, 0, 0.5);
    [self addSubview:backView];
    self.topLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, YBKAdaptiveH(200)-20, Screen_width-20, 20)];
    self.topLabel.backgroundColor = YBKRGBCOLOR(0, 0, 0, 0.5);
    self.topLabel.font = [UIFont systemFontOfSize:12];
    self.topLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.topLabel];
}

@end
